package com.lizhi.yun.db.sfrobot.entity;

import com.lizhi.mybatis.boot.Description;
import com.lizhi.yun.db.sfrobot.common.RobotType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import javax.persistence.*;

/**
 * @Author: lizhi
 * @Description:
 * @Date: create in 2020/11/11 16:41
 */
@Data
@ToString
@Entity
@Table(name="his_center_robot_error")
@Description("机器人重置报错信息")
public class RobotError {
    @Id
    @Column(length = 30)
    @Description("lid")
    public String lid;

    @Column(length = 30)
    @Description("记录id")
    public String id;

    @Column(length = 500)
    @Description("医院id")
    public String hisId;

    @Column(length = 500)
    @Description("机器人编号")
    public String robotNo;

    @Column(length = 500)
    @Description("设备批次编号")
    public String batchNo;

    @Column(length = 500)
    @Description("设备出厂编号")
    public String productNo;

    @Column(length = 20)
    @Description("设备生产日期")
    public String productDate;

    /**
     * @see com.lizhi.yun.db.sfrobot.common.RobotType
     */
    @Column
    @Description("上下肢机器类型")
    public Integer robotType;

    @Description("上下肢机器人类型")
    @Transient
    public String robotTypeText;

    @Column(length = 4000)
    @Description("错误信息")
    public String errorMessage;

    @Column(length = 20)
    @Description("创建时间")
    public String createTime;

    @Column(length = 2)
    @Description("数据上传状态（00-未上传，01-已上传）")
    public String dataUpStatus;

    @Column(length = 20)
    @Description("数据上传时间")
    public String dataUpTime;

    /*云管需要的数据*/
    @ApiModelProperty(value = "医院ID")
    private String hospitalId;

    @ApiModelProperty(value = "系统ID")
    private String hospitalSystemId;

    @Description("无用数据")
    @Transient
    public String cacheKey;

    public String getRobotTypeText() {
        if (RobotType.UpperLimb.getEnValue().equals(this.robotType)){
            this.robotTypeText = RobotType.UpperLimb.getEnName();
        } else if (RobotType.LowerLimb.getEnValue().equals(this.robotType)){
            this.robotTypeText = RobotType.LowerLimb.getEnName();
        }
        return robotTypeText;
    }
}
